package com.zzy.service;

import com.zzy.bridge.*;
import com.zzy.pojo.UserInfo;
import com.zzy.repo.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;

@Service
public class UserBridgeService {

    @Autowired
    private UserRepository userRepository;

    public String login(String account, String password) {
        AbstractRegisterLoginComponent registerLoginComponent =
                RegisterLoginComponentFactory.getInstance(RegisterLoginEnum.DEFAULT);
        return registerLoginComponent.login(account, password);
    }

    public String register(UserInfo userInfo) {
        RegisterLoginComponent registerLoginComponent = new RegisterLoginComponent(new RegisterLoginByDefault());
        return registerLoginComponent.register(userInfo);
    }

    public String login3rd(HttpServletRequest request) {
        RegisterLoginComponent registerLoginComponent = new RegisterLoginComponent(new RegisterLoginByDefault());
        return registerLoginComponent.login3rd(request);
    }
}
